package com.bosssoft.user.permission.center.serve.dao.mapper;

import com.bosssoft.user.permission.center.serve.dao.entity.Resource;
import com.bosssoft.user.permission.center.serve.dao.entity.SubSystem;
import com.bosssoft.user.permission.center.serve.dao.entity.TreeNode;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * <p>
 * 资源 Mapper 接口
 * </p>
 *
 * @author gqx
 * @since 2024-06-06
 */
@Mapper
@Component
public interface ResourceMapper extends tk.mybatis.mapper.common.Mapper<Resource>{

    /**
     * 根据id查询资源
     */
    Resource getById(Long id);
    Page<Resource> pageQuery(Resource basicResource);
    int deleteById(long id);
    int insert(Resource resourceDTO);
    int update(Resource resourceDTO);

    List<SubSystem> getSubsystemName();
    List<String> selectMenuPaths();

    List<TreeNode> selectTree(Long tenantId);

    List<Resource> getAllParent();

    Resource selectById(Long id);

    /**
     * 通过角色id，中间表，查询到最终的资源树
     * @author lanyukai
     * @date 2024/06/18 09:35
     * @param roleId 角色id
     * @return 资源树
     */
    List<TreeNode> selectTreeNodesByRoleId(Long roleId);
    /**
     * 通过父id寻找子节点
     * @author lanyukai
     * @date 2024/06/18 10:16
     * @param parentId 父id
     * @return 资源集合
     */
    List<Resource> selectResourceByParentId(Long parentId);

    List<TreeNode> selectSubTreeNodeByParentId(Long parentId);
}
